package org.bling.star.server.dispatchers;

import org.bling.star.common.command.*;
import org.bling.star.common.response.BaseResponse;
import org.bling.star.server.connect.node.InstanceConnection;
import org.slf4j.Logger;

public class ClientCommandDispatchers {

    private static final Logger log = org.slf4j.LoggerFactory.getLogger(ClientCommandDispatchers.class);

    public ClientCommandDispatchers(StrategyFactory strategyFactory) {
        this.strategyFactory = strategyFactory;
    }

    private final StrategyFactory strategyFactory;
    public BaseResponse dispatcher(ClientCommand clientCommand, InstanceConnection connect) {
        BaseResponse execute = strategyFactory.getStrategy(clientCommand.getCommandType()).execute(clientCommand,connect);
        return execute;
    }
}
